package com.gz.controller;

import com.gz.entity.BookType;
import com.gz.service.BookTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/bookType")

//@CrossOrigin//只针对某个controller进行，局部解决；

public class BookTypeController {
    @Autowired
    private BookTypeService bookTypeService;

    @GetMapping("/getBookType")
    public ResponseEntity getBookType() {

        List<BookType> list = bookTypeService.findAll();
        return ResponseEntity.ok(list);
    }
}
